namespace Box {
    public class ProcessNodeAction : ProcessNode {
        public IProcessTreeAction Action;
        public bool Power = false;

        public override (string,ProcessTreeNodePortType)[] GetPortsDefines() {
            return new (string, ProcessTreeNodePortType)[]{
                ("Input",ProcessTreeNodePortType.Input),
                ("Output",ProcessTreeNodePortType.Output)
            };
        }

        public override void onInputHigh(string from_port) {
            Output("Output",ProcessTreeNodePortStatus.High);
            if(!Power) {
                Power = true;
                Action.Execute();
            }
        }
        public override void onInputLow(string from_port){
            Output("Output",ProcessTreeNodePortStatus.Low);
            Power = false;
        }
    }
}